package org.jiajie.coffeecodes.ali;

import java.util.ArrayDeque;
import java.util.Deque;

/**
 * @author jie
 */
public class ArrayDequeTest {

    public static void main(String[] args) {
        Deque<String> deque = new ArrayDeque<String>(1);

        deque.push("a");
        deque.push("b");
        deque.push("c");
        deque.push("d");

        deque.offerLast("e");
        deque.offerLast("f");
        deque.offerLast("g");
        deque.offerLast("h");   // 这时候扩容了

        deque.push("i");
        deque.offerLast("j");

        System.out.println("数据出栈：");
        while (!deque.isEmpty()){
            System.out.print(deque.pop() + " ");
        }
    }
}
